All Questions
Tagged with programming-challengedynamic-programming
86 questions
5votes
2answers
175views
LeetCode Number 416: Partition Equal Subset Sum
Problem: MLE I am confused as to why the LeetCode judge reports Memory Limit Exceeded when my solution looks close to the editorial solution. I not too familiar with ...
5votes
3answers
959views
LeetCode 678: Valid Parenthesis String, Recursion memoization to DP
How can the following recursion + memoization code be converted into a tabulation format dynamic programming solution? The code is working, but I want to improve it. The challenge I am facing is ...
1vote
1answer
106views
Finding the number of distinct decompositions a number has using only repdigits
This is a problem from a previous semester that I am trying to upsolve. I am trying to solve a problem involving the total number of ways of decomposing a number using only repdigits. A repdigit is a ...
2votes
1answer
50views
Optimal Extraction of Longest Sorted Sequence from Individually Sorted Bucket Arrays Without Repetitions
Consider a bucket array containing sorted and/or empty buckets, and the goal is to extract the longest possible sequence in sorted order, under the following conditions: Only one element in each ...
2votes
5answers
299views
Sum of bitwise XOR of each subarray weighted by length
here is the problem statement You are given an array a of length n consisting of non-negative integers. You have to calculate the value of \$\sum_{l=1}^n \sum_{r=l}^n f(l,r)\cdot (r - l + 1)\$ where \...
1vote
2answers
1kviews
Leetcode 55. Jump Game solution
I was working on Jump Game problem on leetcode Question You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your ...
3votes
1answer
3kviews
Recursive solution of ordered Coin Combinations II (CSES)
Question Link Consider a money system consisting of n coins. Each coin has a positive integer value. Your task is to calculate the number of distinct ordered ways you can produce a money sum x using ...
1vote
2answers
343views
Leetcode 377. Combination Sum IV Javascript Memoization attempt
Problem Statement ...
3votes
1answer
231views
Killing a Hydra - Overengineered
Background This question is inspired by the question: Killing a hydra, and my response therein. I will restate the problem at hand in full so that this question is fully self contained You can only ...
1vote
2answers
124views
I want reduce the time complexity for this ladder problem to find the minimum ladders required
I was trying to attempt below given challenge. I tried multiple ways to solve the problem but none of them were good enough to pass the time limit. Please advise if you have any idea to improve on ...
3votes
0answers
135views
C++ - Longest Common Subsequence
Link to the Problem Here is my code to compute the length of the longest common subsequence of two integer arrays arr[] and brr[]...
3votes
0answers
314views
LeetCode: Stone Game C#
https://leetcode.com/problems/stone-game/ Alex and Lee play a game with piles of stones. There are an even number of piles arranged in a row, and each pile has a positive integer number of stones ...
1vote
1answer
1kviews
Code A Primitive Calculator ( x3,x2,+1) Using Dynamic programming [closed]
Question -You are given a primitive calculator that can perform the following three operations with the current number 𝑥: multiply 𝑥 by 2, multiply 𝑥 by 3, or add 1 to 𝑥. Your goal is given ...
9votes
1answer
2kviews
LeetCode on Longest Palindromic Substring in Python
This is a programming question from LeetCode: Given a string s, return the longest palindromic substring in s. Example 1: Input: s = "babad" Output: "bab" Note: "aba" is ...
1vote
1answer
471views
LeetCode 1320: Minimum Distance to Type a Word Using Two Fingers II
I'm posting my Python code for LeetCode's 1320. If you have time and would like to review, please do so. Problem You have a keyboard layout as shown above in the XY plane, where each English uppercase ...